import {Component, Input} from '@angular/core';
import {
    AlertController, LoadingController, ModalController, NavController, NavParams, Platform,
    ToastController
} from 'ionic-angular';
import {BasePage} from "../../BasePage";
import {Log} from "../../../framework/utils/Log";
import {SystemService} from "../../service/SystemService";
import {FileTransfer, FileUploadOptions, FileTransferObject} from '@ionic-native/file-transfer';
import {File} from '@ionic-native/file';
import {FileOpener} from "@ionic-native/file-opener";
import {ShowpdfPage} from "../../showpdf/showpdf";

import { GalleryModal } from 'ionic-gallery-modal';
import {FilePreview} from "../../../framework/utils/FilePreview";
import {Utils} from "../../../framework/utils/Utils";

/**
 * Generated class for the InformationPage page.
 *
 * See https://ionicframework.com/docs/components/#navigation for more info on
 * Ionic pages and navigation.
 */

@Component({
    selector: 'page-information',
    templateUrl: 'information.html',
    providers: [SystemService]
})
export class InformationPage extends BasePage {
    private static TAG: string = 'InformationPage';
    @Input() detailInfo: any;
    @Input() type: string;
    danJuInfo: any;
    danJuInfoBool: boolean = false;
    private filePreview:any;
    constructor(public navCtrl: NavController,
                public navParams: NavParams,
                public sys: SystemService,
                public platform: Platform,
                public loadingCtrl: LoadingController,
                private fileOpener: FileOpener,
                public fileTransfer: FileTransferObject,
                public toastCtrl: ToastController,
                public alertCtrl: AlertController,
                public modalCtrl: ModalController,
                private file: File) {
        super(platform, loadingCtrl, toastCtrl, alertCtrl);
        this.filePreview = new FilePreview(modalCtrl,loadingCtrl,platform,fileTransfer,file,fileOpener);
    }


    async ngOnInit() {

        this.danJuInfo = this.detailInfo.DanJuXX;
        if (JSON.stringify(this.danJuInfo) == '{}') {
            this.danJuInfoBool = true;
        }
        Log.i(InformationPage.TAG, this.detailInfo);

    }

    sqfjHandler(item) {
        this.filePreview.onView(item);

    }

}


